package trackstacks {

import mx.controls.Alert;
import mx.rpc.IResponder;
import mx.rpc.events.FaultEvent;

public class TokenResponder implements IResponder
{
    private var resultHandler:Function;
    private var faultTitle:String;

    public function TokenResponder(result:Function, faultTitle:String=null)
    {
        super();
        resultHandler = result;
        this.faultTitle = faultTitle;
    }
    public function result(data:Object):void
    {
        resultHandler(data);
    }

    public function fault(info:Object):void
    {
        //the info object from an AsyncToken is always a FaultEvent
        Alert.show(FaultEvent(info).fault.toString(), faultTitle);
    }
}

}